package hardwareToSQL.pruningAlgorithm;

public class PruningGradientComparison implements Pruning{
	
	private double buffer[];
	private double gradientChange;
	private double currentValue;
	
	public PruningGradientComparison(double gradientChange){
		this.gradientChange = gradientChange;
		buffer = new double[4];
		for(int i=0; i<4;i++)
			buffer[i] = 0;
		
		currentValue = 0;
		
	}
	
	public void insertValue(double value){
		for(int i=0; i<3;i++)
			buffer[i] = i+1;
		buffer[3] = value;
		
		if( Math.abs(Math.abs(buffer[0] - buffer[1]) - 
				Math.abs(buffer[2] - buffer[3]))/
				
				Math.abs(buffer[2] - buffer[3])< gradientChange){
			
			currentValue = value;
		}
	}

	public double returnValue() {
		return currentValue;
	}

	
}
